package com.chinasofti;

public class Demo11 {
    public static int[] intArr(int[] arr) {
        int max = arr[0];
        for (int i=0; i<arr.length;i++) {
            if (arr[i]>max){ //遍历数组去寻找更大值
                max = arr[i]; //用更大值定义最大值
            }
        }
        int min = arr[0];
        for (int i=0; i<arr.length;i++) {
            if (arr[i]<min){ //遍历数组去寻找更大值
                min = arr[i]; //用更大值定义最大值
            }
        }
        int []maxAndMin= {max,min};
        return maxAndMin;
    }

    public static void main(String[] args) {
        int[] arr ={11,22,33,66,55};
        int[] arrs = intArr(arr);
        System.out.println("max = " + arrs[0] );
        System.out.println("max = " + arrs[1] );
    }
}
